<?php

namespace app\controller\admin\cnf;

use app\bll\UserLogregConfig as BllUserLogregConfig;
use core\controller\AdminBase;
use Exception;
use support\View;

class UserLogregConfig extends AdminBase
{
    public function index()
    {
        $bllUserLogregConfig = new BllUserLogregConfig();
        if (is_post()) {
            try {
                $data = request()->post();
                $bllUserLogregConfig->save($data);
            } catch (Exception $ex) {
                return $this->error($ex->getMessage());
            }
            return $this->success();
        } else {
            $config = $bllUserLogregConfig->find();
            View::assign('config', $config);
            return $this->view();
        }
    }
}
